The present invention relates to an image encoding device, and more particularly to an image encoding device which encodes image data, an image encoding program and a recording medium for the same. The present invention also relates to an image decoding device which decodes a compressed image file, an image decoding program, and a recording medium for the same, and an electronic camera which is equipped with an image encoding device.